import { makeRequiredRule } from '../../../utils'

const label = '多行文本'
const name = 'textarea'
let i = 1
const uniqueId = () => `${name}${i++}`
export default {
  label,
  name,
  rule() {
    return {
      type: 'input',
      field: uniqueId(),
      title: label,
      info: '',
      props: {
        type: 'textarea',
        resize: 'none'
      }
    }
  },
  props() {
    return [
      makeRequiredRule(),
      { type: 'switch', field: 'showWordLimit', title: '是否显示输入字数统计' },
      { type: 'inputNumber', field: 'maxlength', title: '最大输入长度' },
      {
        type: 'inputNumber',
        field: 'minlength',
        title: '最小输入长度'
      },
      {
        type: 'input',
        field: 'placeholder',
        title: '提示文字'
      },
      {
        type: 'inputNumber',
        field: 'rows',
        title: '输入框行数'
      }
    ]
  }
}
